/************
*The window for the battle mini-game
*@author: Michael Dunn
*@version: 1.0
**/
import java.awt.*;
import java.awt.event.MouseEvent;
import java.awt.event.MouseListener;

import javax.swing.*;

public class BattleWindow{
	
	private BattleController controller;
	private JFrame battleFrame;
	private MarketController nextControl;
	
	public BattleWindow(BattleController controller,MarketController nextControl){
		this.controller = controller;
		this.nextControl = nextControl;
		initialize();
	}
	
	public void initialize(){
		battleFrame = new JFrame("Fight On!");
		battleFrame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
		battleFrame.setBounds(100, 100, 600, 425);
		
		//hides cursor
		ImageIcon blank = new ImageIcon("blank.jpg"); 
		Image	blankCursor = blank.getImage();

		Cursor hiddenCursor = Toolkit.getDefaultToolkit().createCustomCursor(blankCursor, new Point(0,0), "Hidden Cursor");
		battleFrame.setCursor(hiddenCursor);
		battleFrame.addMouseListener(new MouseEventListener());
		controller.addMouseListener(new MouseEventListener());
		battleFrame.getContentPane().add(controller);
		battleFrame.pack();
		battleFrame.setVisible(true);
		
	}
	
	private class MouseEventListener implements MouseListener{
		
		public void mouseClicked(MouseEvent e){	
			if(!controller.isBattling()){
				battleFrame.dispose();
				MarketWindow window = new MarketWindow(nextControl);
			}
		}
		public void mousePressed(MouseEvent e){}
		public void mouseReleased(MouseEvent e){}
		public void mouseHover(MouseEvent e){}
		public void mouseExited(MouseEvent e){}
		public void mouseEntered(MouseEvent e){}
	}

}